/**
 */
package fUML.Semantics.Loci.LociL1.impl;

import fUML.Semantics.Classes.Kernel.Evaluation;

import fUML.Semantics.CommonBehaviors.BasicBehaviors.Execution;
import fUML.Semantics.CommonBehaviors.BasicBehaviors.OpaqueBehaviorExecution;

import fUML.Semantics.Loci.LociL1.ExecutionFactory;
import fUML.Semantics.Loci.LociL1.LociL1Package;
import fUML.Semantics.Loci.LociL1.Locus;
import fUML.Semantics.Loci.LociL1.SemanticStrategy;
import fUML.Semantics.Loci.LociL1.SemanticVisitor;

import fUML.Syntax.Classes.Kernel.Element;
import fUML.Syntax.Classes.Kernel.PrimitiveType;
import fUML.Syntax.Classes.Kernel.ValueSpecification;

import fUML.Syntax.CommonBehaviors.BasicBehaviors.Behavior;
import fUML.Syntax.CommonBehaviors.BasicBehaviors.OpaqueBehavior;

import java.util.Collection;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

import org.eclipse.emf.ecore.util.EObjectResolvingEList;
import org.eclipse.emf.ecore.util.EcoreUtil;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Execution Factory</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link fUML.Semantics.Loci.LociL1.impl.ExecutionFactoryImpl#getLocus <em>Locus</em>}</li>
 *   <li>{@link fUML.Semantics.Loci.LociL1.impl.ExecutionFactoryImpl#getPrimitiveBehaviorPrototypes <em>Primitive Behavior Prototypes</em>}</li>
 *   <li>{@link fUML.Semantics.Loci.LociL1.impl.ExecutionFactoryImpl#getBuiltInTypes <em>Built In Types</em>}</li>
 *   <li>{@link fUML.Semantics.Loci.LociL1.impl.ExecutionFactoryImpl#getStrategies <em>Strategies</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public abstract class ExecutionFactoryImpl extends EObjectImpl implements ExecutionFactory {
	/**
	 * The cached value of the '{@link #getPrimitiveBehaviorPrototypes() <em>Primitive Behavior Prototypes</em>}' reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getPrimitiveBehaviorPrototypes()
	 * @generated
	 * @ordered
	 */
	protected EList<OpaqueBehaviorExecution> primitiveBehaviorPrototypes;

	/**
	 * The cached value of the '{@link #getBuiltInTypes() <em>Built In Types</em>}' reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getBuiltInTypes()
	 * @generated
	 * @ordered
	 */
	protected EList<PrimitiveType> builtInTypes;

	/**
	 * The cached value of the '{@link #getStrategies() <em>Strategies</em>}' reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getStrategies()
	 * @generated
	 * @ordered
	 */
	protected EList<SemanticStrategy> strategies;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ExecutionFactoryImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return LociL1Package.Literals.EXECUTION_FACTORY;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Locus getLocus() {
		if (eContainerFeatureID() != LociL1Package.EXECUTION_FACTORY__LOCUS) return null;
		return (Locus)eContainer();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetLocus(Locus newLocus, NotificationChain msgs) {
		msgs = eBasicSetContainer((InternalEObject)newLocus, LociL1Package.EXECUTION_FACTORY__LOCUS, msgs);
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setLocus(Locus newLocus) {
		if (newLocus != eInternalContainer() || (eContainerFeatureID() != LociL1Package.EXECUTION_FACTORY__LOCUS && newLocus != null)) {
			if (EcoreUtil.isAncestor(this, newLocus))
				throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
			NotificationChain msgs = null;
			if (eInternalContainer() != null)
				msgs = eBasicRemoveFromContainer(msgs);
			if (newLocus != null)
				msgs = ((InternalEObject)newLocus).eInverseAdd(this, LociL1Package.LOCUS__FACTORY, Locus.class, msgs);
			msgs = basicSetLocus(newLocus, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, LociL1Package.EXECUTION_FACTORY__LOCUS, newLocus, newLocus));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<OpaqueBehaviorExecution> getPrimitiveBehaviorPrototypes() {
		if (primitiveBehaviorPrototypes == null) {
			primitiveBehaviorPrototypes = new EObjectResolvingEList<OpaqueBehaviorExecution>(OpaqueBehaviorExecution.class, this, LociL1Package.EXECUTION_FACTORY__PRIMITIVE_BEHAVIOR_PROTOTYPES);
		}
		return primitiveBehaviorPrototypes;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<PrimitiveType> getBuiltInTypes() {
		if (builtInTypes == null) {
			builtInTypes = new EObjectResolvingEList<PrimitiveType>(PrimitiveType.class, this, LociL1Package.EXECUTION_FACTORY__BUILT_IN_TYPES);
		}
		return builtInTypes;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<SemanticStrategy> getStrategies() {
		if (strategies == null) {
			strategies = new EObjectResolvingEList<SemanticStrategy>(SemanticStrategy.class, this, LociL1Package.EXECUTION_FACTORY__STRATEGIES);
		}
		return strategies;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Execution createExecution(Behavior behavior, fUML.Semantics.Classes.Kernel.Object context) {
		// TODO: implement this method
		// Ensure that you remove @generated or mark it @generated NOT
		throw new UnsupportedOperationException();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Evaluation createEvaluation(ValueSpecification specification) {
		// TODO: implement this method
		// Ensure that you remove @generated or mark it @generated NOT
		throw new UnsupportedOperationException();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public SemanticVisitor instantiateVisitor(Element element) {
		// TODO: implement this method
		// Ensure that you remove @generated or mark it @generated NOT
		throw new UnsupportedOperationException();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public OpaqueBehaviorExecution instantiateOpaqueBehaviorExecution(OpaqueBehavior behavior) {
		// TODO: implement this method
		// Ensure that you remove @generated or mark it @generated NOT
		throw new UnsupportedOperationException();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void addPrimitiveBehaviorPrototype(OpaqueBehaviorExecution execution) {
		// TODO: implement this method
		// Ensure that you remove @generated or mark it @generated NOT
		throw new UnsupportedOperationException();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void addBuiltInType(PrimitiveType type) {
		// TODO: implement this method
		// Ensure that you remove @generated or mark it @generated NOT
		throw new UnsupportedOperationException();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public PrimitiveType getBuiltInType(String name) {
		// TODO: implement this method
		// Ensure that you remove @generated or mark it @generated NOT
		throw new UnsupportedOperationException();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setStrategy(SemanticStrategy strategy) {
		// TODO: implement this method
		// Ensure that you remove @generated or mark it @generated NOT
		throw new UnsupportedOperationException();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public SemanticStrategy getStrategy(String name) {
		// TODO: implement this method
		// Ensure that you remove @generated or mark it @generated NOT
		throw new UnsupportedOperationException();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getStrategyIndex(String name) {
		// TODO: implement this method
		// Ensure that you remove @generated or mark it @generated NOT
		throw new UnsupportedOperationException();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case LociL1Package.EXECUTION_FACTORY__LOCUS:
				if (eInternalContainer() != null)
					msgs = eBasicRemoveFromContainer(msgs);
				return basicSetLocus((Locus)otherEnd, msgs);
		}
		return super.eInverseAdd(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case LociL1Package.EXECUTION_FACTORY__LOCUS:
				return basicSetLocus(null, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) {
		switch (eContainerFeatureID()) {
			case LociL1Package.EXECUTION_FACTORY__LOCUS:
				return eInternalContainer().eInverseRemove(this, LociL1Package.LOCUS__FACTORY, Locus.class, msgs);
		}
		return super.eBasicRemoveFromContainerFeature(msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case LociL1Package.EXECUTION_FACTORY__LOCUS:
				return getLocus();
			case LociL1Package.EXECUTION_FACTORY__PRIMITIVE_BEHAVIOR_PROTOTYPES:
				return getPrimitiveBehaviorPrototypes();
			case LociL1Package.EXECUTION_FACTORY__BUILT_IN_TYPES:
				return getBuiltInTypes();
			case LociL1Package.EXECUTION_FACTORY__STRATEGIES:
				return getStrategies();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case LociL1Package.EXECUTION_FACTORY__LOCUS:
				setLocus((Locus)newValue);
				return;
			case LociL1Package.EXECUTION_FACTORY__PRIMITIVE_BEHAVIOR_PROTOTYPES:
				getPrimitiveBehaviorPrototypes().clear();
				getPrimitiveBehaviorPrototypes().addAll((Collection<? extends OpaqueBehaviorExecution>)newValue);
				return;
			case LociL1Package.EXECUTION_FACTORY__BUILT_IN_TYPES:
				getBuiltInTypes().clear();
				getBuiltInTypes().addAll((Collection<? extends PrimitiveType>)newValue);
				return;
			case LociL1Package.EXECUTION_FACTORY__STRATEGIES:
				getStrategies().clear();
				getStrategies().addAll((Collection<? extends SemanticStrategy>)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case LociL1Package.EXECUTION_FACTORY__LOCUS:
				setLocus((Locus)null);
				return;
			case LociL1Package.EXECUTION_FACTORY__PRIMITIVE_BEHAVIOR_PROTOTYPES:
				getPrimitiveBehaviorPrototypes().clear();
				return;
			case LociL1Package.EXECUTION_FACTORY__BUILT_IN_TYPES:
				getBuiltInTypes().clear();
				return;
			case LociL1Package.EXECUTION_FACTORY__STRATEGIES:
				getStrategies().clear();
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case LociL1Package.EXECUTION_FACTORY__LOCUS:
				return getLocus() != null;
			case LociL1Package.EXECUTION_FACTORY__PRIMITIVE_BEHAVIOR_PROTOTYPES:
				return primitiveBehaviorPrototypes != null && !primitiveBehaviorPrototypes.isEmpty();
			case LociL1Package.EXECUTION_FACTORY__BUILT_IN_TYPES:
				return builtInTypes != null && !builtInTypes.isEmpty();
			case LociL1Package.EXECUTION_FACTORY__STRATEGIES:
				return strategies != null && !strategies.isEmpty();
		}
		return super.eIsSet(featureID);
	}

} //ExecutionFactoryImpl
